import { BorderStyleTypes } from '../Enum/BorderStyleTypes';
import { BooleanNumber, HorizontalAlign, TextDecoration, TextDirection, BaselineOffset, VerticalAlign, WrapStrategy } from '../Enum/TextStyle';
import { ThemeColorType } from '../Enum/ThemeColorType';
import { Nullable } from '../../Types/Types';

/**
 * Properties of text decoration
 */
export interface ITextDecoration {
    s: BooleanNumber; // show
    cl?: IColorStyle; // color
    t?: TextDecoration; // lineType
}

/**
 * RGB color or theme color
 */
export interface IColorStyle {
    // rgb?: Nullable<IColor | string>;
    rgb?: Nullable<string>;
    th?: ThemeColorType;
}

/**
 * Format of RBGA color
 */
export interface IColor {
    r: number; // Red
    g: number; // Green
    b: number; // Blue
    a?: number; // Alpha
}

/**
 * Style properties of border
 */
export interface IBorderStyleData {
    s: BorderStyleTypes;
    cl: IColorStyle;
}

/**
 * Style properties of top, bottom, left and right border
 */
export interface IBorderData {
    t?: Nullable<IBorderStyleData>;
    r?: Nullable<IBorderStyleData>;
    b?: Nullable<IBorderStyleData>;
    l?: Nullable<IBorderStyleData>;
}

// export interface IFormatData {
//     /**
//      * format
//      */
//     f: string;
//     /**
//      * 数字     n
//      * 字符串   g
//      * 时间     d
//      * 富文本   r
//      */
//     t: string;
// }

export interface ITextRotation {
    /**
     * angle
     */
    a: number;
    /**
     * vertical
     * true : 1
     * false : 0
     */
    v?: BooleanNumber;
}

/**
 * Top,right,bottom,left padding
 */
export interface IPaddingData {
    t?: number;
    r?: number;
    b?: number;
    l?: number;
}

/**
 * Basics properties of cell style
 */
export interface IStyleBase {
    /**
     * fontFamily
     */
    ff?: Nullable<string>;
    /**
     * fontSize
     *
     * pt
     */
    fs?: number;
    /**
     * italic
     * 0: false
     * 1: true
     */
    it?: BooleanNumber;
    /**
     * bold
     * 0: false
     * 1: true
     */
    bl?: BooleanNumber;

    /**
     * underline
     */
    ul?: ITextDecoration;
    /**
     * strikethrough
     */
    st?: ITextDecoration;
    /**
     * overline
     */
    ol?: ITextDecoration;

    /**
     * background
     */
    bg?: IColorStyle;

    /**
     * border
     */
    bd?: IBorderData;

    /**
     * foreground
     */
    cl?: IColorStyle;

    /**
     * (Subscript 下标 /Superscript上标 Text)
     */
    va?: BaselineOffset;
}

/**
 * Properties of cell style
 */
export interface IStyleData extends IStyleBase {
    /**
     * textRotation
     */
    tr?: Nullable<ITextRotation>;
    /** *
     * textDirection
     */
    td?: Nullable<TextDirection>;
    /**
     * horizontalAlignment
     */
    ht?: Nullable<HorizontalAlign>;
    /**
     * verticalAlignment
     */
    vt?: Nullable<VerticalAlign>;
    /**
     * wrapStrategy
     */
    tb?: Nullable<WrapStrategy>;
    /**
     * padding
     */
    pd?: Nullable<IPaddingData>;
}
